package com.p2p.backend.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.p2p.backend.util.PageUtils;
import com.p2p.base.annotation.PermissionNeed;
import com.p2p.base.page.PageVo;
import com.p2p.front.service.ProtectQuestionService;

/**
 * leiwen@yiqihao.com
 */
@Controller
@RequestMapping("protectquestion")
public class ProtectQuestionController {
	
	@Autowired
	private ProtectQuestionService protectQuestionService;
	
	
	@PermissionNeed("protectquestion_list")
	@RequestMapping("list")
	public void list(PageVo form, Model model) {
		PageVo page = protectQuestionService.listPage(form);
		model.addAttribute("res", 1);
		model.addAttribute("data", PageUtils.data(page));
	}

	@PermissionNeed("protectquestion_remove")
	@RequestMapping("remove")
	public void remove(HttpServletRequest request, @RequestParam Integer id,
			ModelMap model) {
		protectQuestionService.remove(id);
		model.addAttribute("res", 1);
	}
}
